<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Textarea - Mazer Admin Dashboard</title>

    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="/static/assets/css/bootstrap.css">

    <link rel="stylesheet" href="/static/assets/vendors/perfect-scrollbar/perfect-scrollbar.css">
    <link rel="stylesheet" href="/static/assets/vendors/bootstrap-icons/bootstrap-icons.css">
    <link rel="stylesheet" href="/static/assets/css/app.css">
    <link rel="shortcut icon" href="/static/assets/images/favicon.svg" type="image/x-icon">
    <script src="/static/vendor/jquery/jquery.min.js"></script>
</head>

<body>
<div id="app">
    <div style="padding: 20px">
        <div class="page-title">
            <div class="row">
                <div class="col-12 col-md-6 order-md-1 order-last">
                    <h3>Textarea</h3>
                    <p class="text-subtitle text-muted"></p>
                </div>
            </div>
        </div>
        <section class="section">
            <div class="row">
                <!-- input -->
                <div class="col-6">
                    <div class="card">
                        <div class="card-header">
                            Floating Labels
                            <button type="button" style="float: right" class="btn icon btn-primary" onclick="pushData()">generate</button>
                        </div>
                        <div class="card-body">
                            <div class="form-floating">
                                        <textarea class="form-control" placeholder="Leave a comment here"
                                                  id="inputTextarea" style="height: 400px"></textarea>
                                <label for="floatingTextarea">Input :</label>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- output -->
                <div class="col-6">
                    <div class="card">
                        <div class="card-header">
                            Floating Labels
                        </div>
                        <div class="card-body">
                            <div class="form-floating">
                                        <textarea class="form-control" style="height: 400px" readonly
                                                  placeholder="Leave a comment here"
                                                  id="outputTextarea"></textarea>
                                <label for="floatingTextarea">Output : </label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
<script src="/static/assets/vendors/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<script src="/static/assets/js/bootstrap.bundle.min.js"></script>
<script src="/static/assets/js/main.js"></script>
<script>
    //document.getElementById('inputTextarea').value
    function pushData() {
        const input_data = document.getElementById('inputTextarea').value
        $.post('/process/', {
            'csrfmiddlewaretoken': '{{ csrf_token }}',
            'input_data': input_data
        }, function (res) {
            document.getElementById('outputTextarea').value = res['output_data']
        })
    }


</script>
</body>

</html>